﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Runtime.Serialization;

namespace SharedDataContracts
{
    [CollectionDataContract]
    public class BacteriumEventVector : Dictionary<int, BacteriumEventDescriptor>
    {
        public void AppendEvent(BacteriumEventDescriptor eventDescriptor, int initialTS = 1)
        {
            var index = Keys.Count() > 0
                ? this.Keys.Max() + 1
                : initialTS;

            if (Keys.Count >= 6)
                Remove(Keys.Min());

            Add(index, eventDescriptor);

        }
    }
}
